<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@ taglib prefix="pg" tagdir="/WEB-INF/tags" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品大类列表</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.tabfont01 {	
	font-family: "宋体";
	font-size: 9px;
	color: #555555;
	text-decoration: none;
	text-align: center;
}
.font051 {font-family: "宋体";
	font-size: 12px;
	color: #333333;
	text-decoration: none;
	line-height: 20px;
}
.font201 {font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.button {
	font-family: "宋体";
	font-size: 14px;
	height: 37px;
}
html { overflow-x: auto; overflow-y: auto; border:0;} 
-->
</style>
<link href="<c:url value="/styles/ad/css.css"/>" rel="stylesheet" type="text/css" />
<link href="<c:url value="/styles/ad/style.css"/>" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="<c:url value="/scripts/jquery-1.4.4.min.js"/>"></script>
<SCRIPT language=JavaScript>
function selectAll(){
	var obj = document.fom.elements;
	for (var i=0;i<obj.length;i++){
		if (obj[i].name == "delid"){
			obj[i].checked = true;
		}
	}
}

function unselectAll(){
	var obj = document.fom.elements;
	for (var i=0;i<obj.length;i++){
		if (obj[i].name == "delid"){
			if (obj[i].checked==true) obj[i].checked = false;
			else obj[i].checked = true;
		}
	}
}

//删除所有选择的小类
function delSelPly(){
	var plycodeList = "";
	$("input[name='delid']:checked").each(function(){
		plycodeList =plycodeList + $(this).attr("value")+"@";
	});
	if(plycodeList == ""){
		alert("请选择要删除的项");
		return -1;
	}
	plycodeList = plycodeList.substring(0,plycodeList.length-1);
	if(confirm("确定删除？"))
	   	 $.ajax({
	   		url : "delPlyList",
	   		type : "post",
	   		data:"plycodeList="+plycodeList,
	   		dataType:"json",
	   		success : function(data) {
	   			var bool = data.message;
	   			if(bool == "true"){
	   				window.location.reload(); 
	   			}else{
	   				alert("删除失败");
	   			}
	   		}
	   	});
}

//点击删除链接选择性删除
function delPly(plycode){
	if(confirm("确定删除？"))
	   	 $.ajax({
	   		url : "delPly",
	   		type : "post",
	   		data:"plycode="+plycode,
	   		dataType:"json",
	   		success : function(data) {
	   			var bool = data.message;
	   			if(bool == "true"){
	   				window.location.reload(); 
	   			}else{
	   				alert("删除失败");
	   			}
	   		}
	   	});
}

</SCRIPT>
</head>
<body>
<form name="fom" id="fom" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td height="30">      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="62" background="<c:url value="/images/ad/nav04.gif"/>">
          </td>
        </tr>
    </table></td></tr>
  <tr>
    <td><table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
          	 <tr>
               <td height="20"><span class="newfont07">选择：<a href="#" class="right-font08" onclick="selectAll();">全选</a>-<a href="#" class="right-font08" onclick="unselectAll();">反选</a></span>
	              <input name="Submit" type="button" class="right-button08" value="删除所选评论" onclick="delSelPly()"/>
          	 </tr>
              <tr>
                <td height="40" class="font42">
				<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">
				 <tr class="CTitle" >
                    	<td height="22" colspan="7" align="center" style="font-size:16px">商品评论列表</td>
                  </tr>
                  <tr bgcolor="#EEEEEE">
				    <td width="4%" align="center" height="30">选择</td>
                    <td width="10%" align="center">商品评论编号</td>
                    <td width="10%" align="center">商品名称</td>
                    <td width="8%" align="center">评论人 </td>
                    <td width="20%" align="center">评论内容</td>
                    <td width="15%" align="center">评论时间</td>
					<td width="30%" align="center">操作</td>
                  </tr>
                  <c:forEach items="${plys.getList()}" var="ply">
				  <tr bgcolor="#FFFFFF">
				    <td height="20"><input type="checkbox" name="delid" value="${ply.getStr('plycode')}"/></td>
                    <td align="center">${ply.getStr("plycode")}</td>
                    <td align="center">${ply.getStr("pname")}</td>
                    <td align="center">${ply.getStr("uname")}</td>
                    <td align="center">${ply.getStr("plycontent")}</td>
                    <td align="center">${ply.getStr("plytime")}</td>
                    <td align="center">
                    <a href="<c:url value="goToDetail?plycode=${ply.getStr('plycode')}"/>">查看详情</a>|
                    <a href="javascript:void(0);" onclick="delPly('${ply.getStr('plycode')}');">删除</a></td>
                  </tr>
                  </c:forEach>
                <tr bgcolor="#EEEEEE">
				<td align="center" colspan="7"	style="line-height: 40px">
						<pg:paging
							currentPage="${plys.getPageNumber()}"
							baseUrl="?keyword=${keyword}&start-time=${start}&end-time=${end}&reco-state=${state}&dlcode=${dlcode}&" total="${plys.getTotalRow()}" 
							pageSize="55"></pg:paging></td>
				</tr>
            </table></td>
        </tr>
      </table>
</td>
  </tr>
</table>
</form>
</body>
</html>